$(document).ready(function(){
	var ctx = $("#ctx").val();//获取服务器地址
	
	$("#all-btn-upload").click(function(){
		var advertiserId = $("#advertiserId").val();
		if(advertiserId == "" || advertiserId == -1){
			bootbox.alert("请选择广告主！");
			return false;
		}else{
			openWindow("创建创意素材",ctx+"/advertiser/main/ad/banner-template/openWindow?advertiserId="+advertiserId);	
		}
	});
	
	$('#btn_win_clear').click(function(){
		$('#content').val('');
		$('#all-input-file').val('');
	});
	
	$(".banner-win-radio").click(function(){
		if($(this).val() == 4){
			$("#picAndContent").css("display","none");
		}
	});
	$('#btn_win_cannel').click(function(){
		var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
		parent.layer.close(index);//再执行关闭
	});
	
	//上传文件
	$('#all-input-file').click(function(){
		
	});
	
	//保存
	$('#btn_win_save').click(function(){
		
	});
	
});


function openWindow(title,url){
	layer.open({
	    type: 2,
		title: title,
		shadeClose: false,
		shade: 0.6,
		minmax:true,
		fix:false,
		closeBtn:0,
		area: ['500px','300px'],
		content: url
	});
}